package com.celesea.workflow.core.entity;

import com.celesea.framework.entity.BusEntity;
import com.celesea.framework.util.Version;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * 流程节点 ，
 * 包含 节点授权，用于控制权限，选择处理人
 * 包含 节点动作，用于控制流程扭转
 *
 * @author JackYuan
 * @create 2017-11-05 16:28
 */
@Version
@Table(name = "wf_node")
public class WorkflowNode extends BusEntity {

    public enum WorkflowNodeType {
        BEGIN("startNode", "开始节点"),
        TASK("taskNode", "任务节点"),
        BRANCH("branchNode", "分支节点"),
        MERGE("mergeNode", "合并节点"),
        SYNC("syncNode", "会签节点"),
        CONDITION("conditionNode", "条件节点"),
        COMPLETE("completeNode", "完成节点"),
        END("endNode", "结束节点"),
        ERROR("errorNode", "异常节点"),
        ;
        private String code;
        private String name;

        WorkflowNodeType(String code, String name) {
            this.code = code;
            this.name = name;
        }

        public String getCode() {
            return code;
        }

        public String getName() {
            return name;
        }
    }

    @Column(name = "`wf_id`", columnDefinition = "流程id")
    protected String wfId;

    @Column(name = "`next_id`", columnDefinition = "流程下一个节点id")
    protected String nextId;

    @Column(name = "`name`", columnDefinition = "节点名称")
    protected String name;

    @Column(name = "`type`", columnDefinition = "节点类型")
    protected String type;

    @Column(name = "`status`", columnDefinition = "节点状态")
    protected Integer status;

    public String getWfId() {
        return wfId;
    }

    public void setWfId(String wfId) {
        this.wfId = wfId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
}
